package org.quipu.dto;

import java.io.Serializable;
import java.util.Collection;
import java.util.LinkedList;

public class UniqueDto implements Serializable {

    private Long id;

    public UniqueDto() {
    }

    public UniqueDto(Long id) {
        this.id = id;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public boolean isNew() {
        return id == null;
    }

    public static Collection<Long> getIds(Collection<? extends UniqueDto> dtos) {
        Collection<Long> ids = new LinkedList<Long>();
        if(dtos != null) {
            for(UniqueDto dto: dtos)
                ids.add(dto.getId());
        }
        return ids;
    }
}
